package com.suitsoft.ut.service.base;

import jxl.Sheet;

import com.suitsoft.ut.service.ServiceException;
import com.suitsoft.ut.util.ExcelTools;
import com.suitsoft.ut.util.StringUtils;

/**
 * 教师临时精
 *@author Suine
 */
public class ExcelDataTeacher{
	
	private String name;
	/** 工号 */
	private String no;
	/** 学院 名 */
	private String college;
	/** 工作时间 */
	private String workDate;
	/** 联系电话 */
	private String telephone;
	/** mail */
	private String email;
	/** 操作人 */
	private Long userId;
	/** 备注 */
	private String memo;
	/** 是否确认 */
	private Long isConfirm;
	/** 职称 */
	private String titile;
	
	public ExcelDataTeacher(Sheet sheet,int row){
		String content = null;
		content = sheet.getCell(ExcelTools.COL_A,row).getContents();
		college = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_B,row).getContents();
		name = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_C,row).getContents();
		no = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_D,row).getContents();
		titile = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_E,row).getContents();
		workDate = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_F,row).getContents();
		telephone = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_G,row).getContents();
		email = content == null ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_H,row).getContents();
		memo = content == null ? "" : content;
		
		if(StringUtils.isEmpty(name) && StringUtils.isEmpty(no) && StringUtils.isEmpty(college) && StringUtils.isEmpty(workDate)
				&& StringUtils.isEmpty(titile) && StringUtils.isEmpty(telephone) && StringUtils.isEmpty(email)
				&& StringUtils.isEmpty(memo) 
		){
			throw new ServiceException("存在空行");
		}
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	public String getCollege() {
		return college;
	}
	public void setCollege(String college) {
		this.college = college;
	}
	public String getWorkDate() {
		return workDate;
	}
	public void setWorkDate(String workDate) {
		this.workDate = workDate;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Long getUserId() {
		return userId;
	}
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public Long getIsConfirm() {
		return isConfirm;
	}
	public void setIsConfirm(Long isConfirm) {
		this.isConfirm = isConfirm;
	}
	public String getTitile() {
		return titile;
	}
	public void setTitile(String titile) {
		this.titile = titile;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((no == null) ? 0 : no.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExcelDataTeacher other = (ExcelDataTeacher) obj;
		if (no == null) {
			if (other.no != null)
				return false;
		} else if (!no.equals(other.no))
			return false;
		return true;
	}
}

